package com.tencent.wxcloudrun.pojo.bo;

import java.util.HashMap;
import java.util.Map;

public enum NoticeReadEnum {
    no("no", "未读"),
    yes("yes", "已读");

    // 创建一个映射来存储键值对以便快速查找
    public static final Map<String, NoticeReadEnum> keyToEnumMap = new HashMap<>();
    public static final Map<String, NoticeReadEnum> valueToEnumMap = new HashMap<>();

    // 初始化映射
    static {
        for (NoticeReadEnum status : values()) {
            keyToEnumMap.put(status.key, status);
            valueToEnumMap.put(status.value, status);
        }
    }

    private final String key;
    private final String value;

    NoticeReadEnum(String key, String value) {
        this.key = key;
        this.value = value;
    }

    // 通过 key 查找对应的枚举实例
    public static NoticeReadEnum findByKey(String key) {
        return keyToEnumMap.get(key);
    }

    // 通过 value 查找对应的枚举实例
    public static NoticeReadEnum findByValue(String value) {
        return valueToEnumMap.get(value);
    }

    public String getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }
}
